<style>
    #ortum_moreSettings_ModalLabel .card-header{
        padding: 0px;
    }
    #ortum_moreSettings_ModalLabel .card-header .btn:focus{
        box-shadow:none;
    }
    #ortum_moreSettings_page_switch{
        display: none;
    }
    #collapseOne .custom-control{
        margin:6px 0;
    }
</style>

<div class="modal-header">
    <h5 class="modal-title" >设置</h5>
    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
        <span aria-hidden="true">&times;</span>
    </button>
</div>
<div class="modal-body" id="ortum_moreSettings_ModalLabel">
    <div class="accordion" id="accordionExample">
        <div class="card">
            <div class="card-header" id="headingOne">
                <h2 class="mb-0">
                    <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                        保存设置
                    </button>
                </h2>
            </div>
            <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
                <div class="card-body">
                    <div class="custom-control custom-switch">
                        <input type="checkbox" name="ortum_property_save_checkVersion" class="custom-control-input" id="ortum_moreSettings_save_checkVersion">
                        <label class="custom-control-label" for="ortum_moreSettings_save_checkVersion">保存时不检验版本</label>
                    </div>
                    <div class="custom-control custom-switch">
                        <input type="checkbox" name="ortum_property_babel_transfer" class="custom-control-input" id="ortum_moreSettings_babel_transfer">
                        <label class="custom-control-label" for="ortum_moreSettings_babel_transfer">兼容IE</label>
                    </div>
                    <div class="custom-control custom-switch">
                        <input type="checkbox" name="ortum_property_packer_zip" class="custom-control-input" id="ortum_moreSettings_packer_zip">
                        <label class="custom-control-label" for="ortum_moreSettings_packer_zip">压缩js代码(待开发)</label>
                    </div>
                    <div class="custom-control custom-switch">
                        <input type="checkbox" name="ortum_property_packer_cancel_note" class="custom-control-input" id="ortum_moreSettings_packer_cancelNote">
                        <label class="custom-control-label" for="ortum_moreSettings_packer_cancelNote">去除js注释(待开发)</label>
                    </div>
                </div>
            </div>
        </div>
        <div class="card">
            <div class="card-header" id="headingTwo">
                <h2 class="mb-0">
                    <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
                        页面操作
                    </button>
                </h2>
            </div>
            <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
                <div class="card-body">
                    <div id="ortum_moreSettings_page_switch">
                        <button type="button" class="btn btn-outline-primary ortum_form_switch">切换新增</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
</div>
<script>
    //显示 切换新增
    if($(".ortum_table_method").attr("data-formid")){
        $("#ortum_moreSettings_page_switch").show();
    };

    require(['feature','assist'],function(Feature,Assist){
        //检验保存版本
        if(Assist.ortumLocalStorage.getItem("SaveNoCheckVersion")){
            $("#ortum_moreSettings_save_checkVersion").attr("checked","checked");
        };
        $("#ortum_moreSettings_save_checkVersion").off("click.checkVersion").on('click.checkVersion',function (e) {
            if(e.target.checked){
                Assist.ortumLocalStorage.setItem("SaveNoCheckVersion",true)
            }else{
                Assist.ortumLocalStorage.removeItem("SaveNoCheckVersion")
            }
        });

        //babel转义，IE兼容
        if(Assist.ortumLocalStorage.getItem("BabelTransferCode")){
            $("#ortum_moreSettings_babel_transfer").attr("checked","checked");
        };
        $("#ortum_moreSettings_babel_transfer").off("click.transfer").on('click.transfer',function (e) {
            if(e.target.checked){
                Assist.ortumLocalStorage.setItem("BabelTransferCode",true)
            }else{
                Assist.ortumLocalStorage.removeItem("BabelTransferCode")
            }
        });
        //压缩js代码
        if(Assist.ortumLocalStorage.getItem("ZipJsCode")){
            $("#ortum_moreSettings_packer_zip").attr("checked","checked");
        };
        $("#ortum_moreSettings_packer_zip").off("click.transfer").on('click.transfer',function (e) {
            if(e.target.checked){
                Assist.ortumLocalStorage.setItem("ZipJsCode",true)
            }else{
                Assist.ortumLocalStorage.removeItem("ZipJsCode")
            }
        });
        //去除js注释
        if(Assist.ortumLocalStorage.getItem("CancelJsNote")){
            $("#ortum_moreSettings_packer_cancelNote").attr("checked","checked");
        };
        $("#ortum_moreSettings_packer_cancelNote").off("click.transfer").on('click.transfer',function (e) {
            if(e.target.checked){
                Assist.ortumLocalStorage.setItem("CancelJsNote",true)
            }else{
                Assist.ortumLocalStorage.removeItem("CancelJsNote")
            }
        });

    });

    //切换新增
    $(".ortum_form_switch").off("click.switch").on('click.switch',function (e) {
        let sureSwitch = confirm("确定切换成新表单,并使用当前表单的内容吗？");
        if(sureSwitch){
            switchTableAct("new");
            $("#ortum_moreSettings_page_switch").hide()
        };
    });
</script>
